import { loginApi } from "@/api/modules/login"
export default {
  namespaced: true,
  state: {
    count: 555
  },
  mutations: {
    add(state) {
      state.count++
    }
  },
  actions: {
    login({ commit }, formData) {
      return new Promise((resolve, reject) => {
        loginApi({ ...formData }).then(res => {
          localStorage.setItem("username", res.data.username)
          localStorage.setItem("token", res.data.token)
          resolve(res)
        })
      })
    }
  }
}
